using Microsoft.EntityFrameworkCore;
using WEB.API.Model;
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

//从配置文件中获取连接数据库字符串

var conString = builder.Configuration.GetConnectionString("mysql");

//配置数据库上下文,使用MySql数据库 并自动检测服务器版本

builder.Services.AddDbContext<WebDbContext>(x => x.UseMySql(conString, ServerVersion.AutoDetect(conString)));


var app = builder.Build();

app.MapControllers();

app.Run();


